<template>
  <el-menu
    class="el-menu-vertical-demo"
    :collapse="homeStore.isCollapse"
    :router="true"
  >
    <template v-for="item in bannerStore.menuList2" :key="item.index">
      <el-menu-item :index="item.index" v-if="!item.children">
        <el-icon><component :is="item.icon"></component></el-icon>
        <span>{{ item.title }}</span>
      </el-menu-item>

      <el-sub-menu :index="item.index" v-else>
        <template #title>
          <el-icon>
            <component :is="item.icon"></component>
          </el-icon>
          <span>{{ item.title }}</span>
        </template>
        <el-menu-item
          v-for="val in item.children"
          :index="val.index"
          style="background-color: #000c17"
        >
          {{ val.title }}
        </el-menu-item>
      </el-sub-menu>
    </template>
  </el-menu>
</template>

<script lang="ts" setup>
import { useHomeStore } from "@/stores/home";
import { useBannerStore } from "@/stores/banner";

const homeStore = useHomeStore();
const bannerStore = useBannerStore();

// const isCollapse = ref<boolean>(true);
</script>

<style lang="less">
.el-menu {
  background-color: #001529;
  border-right: 1px solid #001529;
}
.el-menu-item {
  color: #fff;
}
.el-sub-menu__title {
  color: #fff;
}
.el-menu-item:hover {
  background-color: unset;
}
.el-sub-menu__title:hover {
  background-color: unset;
}
</style>
